package com.advanced.commonlyUsedClass_2.packaging;

import java.util.Random;
import java.util.Scanner;

/**
 * 输入要掷骰子的次数，统计各点数出现的次数。
 *
 * @author: Jovi
 * @createTime: 2017-06-06 16:52
 **/
public class Dice {

    public static void main(String[] args) {
        System.out.println("Enter the number of dice：");
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
        Random random = new Random();
        for (int j = 0; j < i; j++) {
            int num = random.nextInt(6) + 1;
            switch (num) {
                case 1:
                    a++;
                    break;
                case 2:
                    b++;
                    break;
                case 3:
                    c++;
                    break;
                case 4:
                    d++;
                    break;
                case 5:
                    e++;
                    break;
                case 6:
                    f++;
                    break;
            }
        }
        System.out.println("dice result is ");
        System.out.println("1 is "+a+"order ，2 is "+b+"order ,3 is "+c+"order , 4 is"+d+"order , 5 is"+e+"order, 6 is"+f);
    }
}
